<?php
namespace ITSociaal\Themes\Lumber;

use Timber\{FunctionWrapper, Helper, PostQuery};
use Timber\{Request, URLHelper};
use Timber\User;
use Timber as Lumber;

class Timber extends Lumber {

	/**
	 * Get context.
	 *
	 * @codeCoverageIgnore
	 *
	 * @return array
	 */
	public static function get_context() {
		if (empty(static::$context_cache)) {
			static::$context_cache["http_host"] = URLHelper::get_scheme() . "://" . URLHelper::get_host();
			static::$context_cache["body_class"] = implode(" ", get_body_class());

			static::$context_cache["request"] = new Request();
			$user = new User();
			static::$context_cache["user"] = ($user->ID) ? $user : false;

			static::$context_cache["posts"] = new PostQuery();

			static::$context_cache = apply_filters("timber_context", static::$context_cache);
			static::$context_cache = apply_filters("timber/context", static::$context_cache);
		}

		return static::$context_cache;
	}

}

/* vi:set ts=4 sw=4 noet: */
